# def check_num(number: int):
#     total = sum([int(num) ** len(str(number)) for num in list(str(number))])
#     if number < 100:
#         return False
#     if total == number:
#         return True
#     else:
#         return False
#
#
# for n in range(1, 100000):
#     if check_num(n):
#         print("{} 是水仙花数".format(n))

#
def is_narcissistic(num):
    num_str = str(num)
    n = len(num_str)
    total = sum(int(digit) ** n for digit in num_str)
    return total == num and num >= 100


def find_narcissistic_numbers(start, end):
    return [i for i in range(start, end + 1) if is_narcissistic(i)]


start_range = 1
end_range = 10000000
narcissistic_numbers = find_narcissistic_numbers(start_range, end_range)
print(f"{start_range} 到 {end_range} 之间的自幂数：{narcissistic_numbers}")
